package tv.huan.media.util;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import tv.huan.media.domain.Album;

import java.util.List;

/**
 * 邮件发送工具类
 *
 * @author ruoyi
 *
 */
public class MailInfoUtil {

    //版权到期提醒
    public static final String COPYRIGHT_WARN = "copyrightWarn";

    //推荐
    public static final String RECOMEND = "recommend";

    //上线
    public static final String ON_LINE = "online";

    //不可上线
    public static final String NOT_ALLOW_ON_LINE = "notAllowOnline";

    //下线
    public static final String OFF_LINE = "offline";

    //下线通知
    public static final String OFF_LINE_NOTIFY = "offlineNotify";


    /**
     * 获取发送邮件的json
     * @param subject 主题
     * @param text 正文
     * @param mailType 邮件类型
     * @param albumList 片单列表（选用）
     * @return jsonString
     */
    public static String getRequestJsonParam(String subject, String text, String mailType, List<Album> albumList){
        JSONObject json = new JSONObject();
        json.put("type", mailType);
        json.put("subject",subject);
        json.put("text",text);
        JSONArray array = JSONArray.parseArray(JSON.toJSONString(albumList));
        json.put("array",array);
        return json.toJSONString();
    }
}
